package org.openwebtop.sunshine.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.openwebtop.sunshine.domain.ReviewProject;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class ReviewProjectDAO extends HibernateDaoSupport {

	public ReviewProject getReviewProject(String name) {
		return (ReviewProject)getHibernateTemplate().get(ReviewProject.class, name);
	}

	@SuppressWarnings("unchecked")
	public List<ReviewProject> getReviewProjects() {
		final DetachedCriteria criteria = DetachedCriteria.forClass(ReviewProject.class);
		criteria.addOrder(Order.asc("name"));

		return getHibernateTemplate().findByCriteria(criteria);
	}

}
